<section class="breadcrumb-root">
  <div class="breadcrumbs" role="navigation" aria-label="breadcrumbs navigation">
    {{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} {{ $.Scratch.Add "path" .Site.BaseURL }}

    <a class="breadcrumb" href="{{ .Site.BaseURL }}">
      <i class="material-icons">location_on</i>Home</a>
    {{ range $index, $element := split $url "/" }} {{ $.Scratch.Add "path" $element }} {{ $.Scratch.Add "path" "/" }}
    <!-- Check if the current list item is the last one -->
    {{ $isLast := eq ($.Scratch.Get "path") $.Permalink }} {{ if ne $element "" }} {{ if $isLast }}
    <span class="breadcrumb">{{ $.Title }}</span>

    {{ else if eq $element "posts" }}
    <!-- <span class="breadcrumb">Posts</span> -->
    {{ else }}
    <a class="breadcrumb" href='{{ $.Scratch.Get "path" }}'>{{ title ( replace . "-" " ") }}</a>
    {{ end }} {{ end }} {{ end }}
  </div>
</section>